home *** CD-ROM | disk | FTP | other *** search
/ Hardcore Visual Basic 5.0 (2nd Edition) / Hardcore Visual Basic 5.0 - Second Edition (1997)(Microsoft Press).iso / Code / TMessage.frm < prev    next >
Text File  |  1997-06-14  |  9KB  |  288 lines

  1. VERSION 5.00
  2. Begin VB.Form FTestMessages 
  3.    Caption         =   "Test Message Capture A"
  4.    ClientHeight    =   4365
  5.    ClientLeft      =   1650
  6.    ClientTop       =   4710
  7.    ClientWidth     =   4005
  8.    Icon            =   "TMessage.frx":0000
  9.    LinkTopic       =   "Form1"
  10.    ScaleHeight     =   4365
  11.    ScaleWidth      =   4005
  12.    Begin VB.Frame fmCapture 
  13.       Caption         =   "Message Capture"
  14.       Height          =   3984
  15.       Left            =   168
  16.       TabIndex        =   9
  17.       Top             =   204
  18.       Width           =   3636
  19.       Begin VB.TextBox txtMinMax 
  20.          Height          =   288
  21.          Index           =   0
  22.          Left            =   180
  23.          TabIndex        =   1
  24.          Top             =   1524
  25.          Width           =   1296
  26.       End
  27.       Begin VB.TextBox txtMinMax 
  28.          Height          =   288
  29.          Index           =   1
  30.          Left            =   2136
  31.          TabIndex        =   2
  32.          Top             =   1512
  33.          Width           =   1296
  34.       End
  35.       Begin VB.TextBox txtMinMax 
  36.          Height          =   288
  37.          Index           =   2
  38.          Left            =   180
  39.          TabIndex        =   3
  40.          Top             =   2172
  41.          Width           =   1296
  42.       End
  43.       Begin VB.TextBox txtMinMax 
  44.          Height          =   288
  45.          Index           =   3
  46.          Left            =   2136
  47.          TabIndex        =   4
  48.          Top             =   2172
  49.          Width           =   1296
  50.       End
  51.       Begin VB.TextBox txtMinMax 
  52.          Height          =   288
  53.          Index           =   4
  54.          Left            =   180
  55.          TabIndex        =   5
  56.          Top             =   2820
  57.          Width           =   1296
  58.       End
  59.       Begin VB.TextBox txtMinMax 
  60.          Height          =   288
  61.          Index           =   5
  62.          Left            =   2136
  63.          TabIndex        =   6
  64.          Top             =   2820
  65.          Width           =   1296
  66.       End
  67.       Begin VB.TextBox txtMinMax 
  68.          Height          =   288
  69.          Index           =   6
  70.          Left            =   180
  71.          TabIndex        =   7
  72.          Top             =   3468
  73.          Width           =   1296
  74.       End
  75.       Begin VB.TextBox txtMinMax 
  76.          Height          =   288
  77.          Index           =   7
  78.          Left            =   2136
  79.          TabIndex        =   8
  80.          Top             =   3480
  81.          Width           =   1296
  82.       End
  83.       Begin VB.CommandButton cmdNew 
  84.          Caption         =   "New Form"
  85.          Height          =   396
  86.          Left            =   168
  87.          TabIndex        =   0
  88.          Top             =   660
  89.          Width           =   3288
  90.       End
  91.       Begin VB.Label lbl 
  92.          Caption         =   "Check the system menu"
  93.          Height          =   324
  94.          Index           =   0
  95.          Left            =   888
  96.          TabIndex        =   18
  97.          Top             =   264
  98.          Width           =   1764
  99.       End
  100.       Begin VB.Label lbl 
  101.          Caption         =   "Minimum width: "
  102.          Height          =   228
  103.          Index           =   1
  104.          Left            =   180
  105.          TabIndex        =   17
  106.          Top             =   1224
  107.          Width           =   1296
  108.       End
  109.       Begin VB.Label lbl 
  110.          Caption         =   "Maximized left:"
  111.          Height          =   228
  112.          Index           =   4
  113.          Left            =   180
  114.          TabIndex        =   16
  115.          Top             =   2520
  116.          Width           =   1296
  117.       End
  118.       Begin VB.Label lbl 
  119.          Caption         =   "Maximimum height:"
  120.          Height          =   228
  121.          Index           =   5
  122.          Left            =   2136
  123.          TabIndex        =   15
  124.          Top             =   1872
  125.          Width           =   1428
  126.       End
  127.       Begin VB.Label lbl 
  128.          Caption         =   "Maximimum width:"
  129.          Height          =   228
  130.          Index           =   6
  131.          Left            =   180
  132.          TabIndex        =   14
  133.          Top             =   1872
  134.          Width           =   1296
  135.       End
  136.       Begin VB.Label lbl 
  137.          Caption         =   "Minimum height:"
  138.          Height          =   228
  139.          Index           =   7
  140.          Left            =   2136
  141.          TabIndex        =   13
  142.          Top             =   1212
  143.          Width           =   1296
  144.       End
  145.       Begin VB.Label lbl 
  146.          Caption         =   "Maximized width:"
  147.          Height          =   228
  148.          Index           =   8
  149.          Left            =   2136
  150.          TabIndex        =   12
  151.          Top             =   3180
  152.          Width           =   1296
  153.       End
  154.       Begin VB.Label lbl 
  155.          Caption         =   "Maximized width:"
  156.          Height          =   228
  157.          Index           =   9
  158.          Left            =   180
  159.          TabIndex        =   11
  160.          Top             =   3168
  161.          Width           =   1296
  162.       End
  163.       Begin VB.Label lbl 
  164.          Caption         =   "Maximized top:"
  165.          Height          =   228
  166.          Index           =   10
  167.          Left            =   2136
  168.          TabIndex        =   10
  169.          Top             =   2532
  170.          Width           =   1296
  171.       End
  172.    End
  173. End
  174. Attribute VB_Name = "FTestMessages"
  175. Attribute VB_GlobalNameSpace = False
  176. Attribute VB_Creatable = False
  177. Attribute VB_PredeclaredId = True
  178. Attribute VB_Exposed = False
  179. Attribute VB_Ext_KEY = "RepId" ,"4FB51841-CEAF-11CF-A15E-00AA00A74D48-0050"
  180. Option Explicit
  181.  
  182. Private WithEvents sysmenu As CSysMenu
  183. Attribute sysmenu.VB_VarHelpID = -1
  184. Private idAbout As Long
  185. Private idAround As Long
  186.  
  187. Private minmax As New CMinMax
  188. Attribute minmax.VB_VarHelpID = -1
  189. Enum EMinMax
  190.     emmMinWidth
  191.     emmMinHeight
  192.     emmMaxWidth
  193.     emmMaxHeight
  194.     emmMaximizedLeft
  195.     emmMaximizedTop
  196.     emmMaximizedWidth
  197.     emmMaximizedHeight
  198. End Enum
  199.  
  200. Private Sub cmdNew_Click()
  201.     Dim frm As New FTestMessages
  202.     frm.Left = Left + Width * 0.1
  203.     frm.Top = Top + Height * 0.1
  204.     frm.Top = Top + Height * 0.1
  205.     frm.Caption = Caption & "A"
  206.     frm.Show
  207. End Sub
  208.  
  209. Private Sub Form_Load()
  210.     ' Initialize system menu
  211.     Set sysmenu = New CSysMenu
  212.     sysmenu.Create hWnd
  213.     Call sysmenu.AddItem("-")   ' Separator
  214.     idAbout = sysmenu.AddItem("About...")
  215.     idAround = sysmenu.AddItem("Around...")
  216.     
  217.     ' Initialize minimums and maximums
  218.     With minmax
  219.         .Create hWnd
  220.         .MinWidth = fmCapture.Width
  221.         txtMinMax(emmMinWidth) = .MinWidth
  222.         .MinHeight = fmCapture.Height
  223.         txtMinMax(emmMinHeight) = .MinHeight
  224.         .MaxWidth = Screen.Width * 0.8
  225.         txtMinMax(emmMaxWidth) = .MaxWidth
  226.         .MaxHeight = Screen.Height * 0.8
  227.         txtMinMax(emmMaxHeight) = .MaxHeight
  228.         .MaximizedLeft = Screen.Width * 0.1
  229.         txtMinMax(emmMaximizedLeft) = .MaximizedLeft
  230.         .MaximizedTop = Screen.Height * 0.1
  231.         txtMinMax(emmMaximizedTop) = .MaximizedTop
  232.         .MaximizedWidth = Screen.Width * 0.8
  233.         txtMinMax(emmMaximizedWidth) = .MaximizedWidth
  234.         .MaximizedHeight = Screen.Height * 0.8
  235.         txtMinMax(emmMaximizedHeight) = .MaximizedHeight
  236.     End With
  237. End Sub
  238.  
  239. Private Sub Form_Activate()
  240.     txtMinMax(0).SetFocus
  241. End Sub
  242.  
  243. Private Sub Form_Resize()
  244.     fmCapture.Left = (ScaleWidth / 2) - (fmCapture.Width / 2)
  245.     fmCapture.Top = (ScaleHeight / 2) - (fmCapture.Height / 2)
  246. End Sub
  247.  
  248. Private Sub sysmenu_MenuClick(sItem As String, ByVal ID As Long)
  249.     Select Case ID
  250.     Case idAbout
  251.         MsgBox "About time"
  252.     Case idAround
  253.         MsgBox "Around and around"
  254.     End Select
  255. End Sub
  256.  
  257. Private Sub txtMinMax_LostFocus(Index As Integer)
  258. With minmax
  259.     Select Case Index
  260.     Case emmMaximizedLeft
  261.         .MaximizedLeft = txtMinMax(emmMaximizedLeft)
  262.     Case emmMaximizedTop
  263.         .MaximizedTop = txtMinMax(emmMaximizedTop)
  264.     Case emmMaximizedWidth
  265.         .MaximizedWidth = txtMinMax(emmMaximizedWidth)
  266.     Case emmMaximizedHeight
  267.         .MaximizedHeight = txtMinMax(emmMaximizedHeight)
  268.     Case emmMinWidth
  269.         .MinWidth = txtMinMax(emmMinWidth)
  270.     Case emmMinHeight
  271.         .MinHeight = txtMinMax(emmMinHeight)
  272.     Case emmMaxWidth
  273.         .MaxWidth = txtMinMax(emmMaxWidth)
  274.     Case emmMaxHeight
  275.         .MaxHeight = txtMinMax(emmMaxHeight)
  276.     End Select
  277.     ' Update all because some changes affect others
  278.     txtMinMax(emmMinWidth) = .MinWidth
  279.     txtMinMax(emmMinHeight) = .MinHeight
  280.     txtMinMax(emmMaxWidth) = .MaxWidth
  281.     txtMinMax(emmMaxHeight) = .MaxHeight
  282.     txtMinMax(emmMaximizedLeft) = .MaximizedLeft
  283.     txtMinMax(emmMaximizedTop) = .MaximizedTop
  284.     txtMinMax(emmMaximizedWidth) = .MaximizedWidth
  285.     txtMinMax(emmMaximizedHeight) = .MaximizedHeight
  286. End With
  287. End Sub
  288.